$(function () {
    $('.btn-delete').click(function () {
        Swal.fire({
            title: '确定要删除吗?',
            text: "回不来了哦!",
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: '删!!!',
            cancelButtonText: '算了算了'


        }).then((result) => {

            if (result.value) {

                Swal.fire(
                    'Deleted!',
                    'Your file has been deleted.',
                    'success'
            );
                var $1 = $(this);
                setTimeout(function () {
                },1000);

                $.ajax({
                    url : $1.data('url'),
                    type : "DELETE",
                    success : function (data) {
                        if (data.success){
                            Swal.fire({
                                title: data.msg,

                                showCancelButton: true,
                                confirmButtonColor: '#3085d6',
                                cancelButtonColor: '#d33',
                                confirmButtonText: "好了",
                            })
                            setTimeout(function () {
                            },1000);

                            window.location.href="/employees"
                        }
                    }
                })

            }

        });
    });

    $('.input-date').datetimepicker({
        format:'yyyy-mm-dd', //格式
        language:'zh-CN', //中文
        autoclose: true,//选择后自动关闭
        minView:2,//精确到哪位
    });

    $('.date-app').datetimepicker({
        format:'yyyy-mm-dd hh:ii', //格式
        language:'zh-CN', //中文
        autoclose: true,//选择后自动关闭
        minView:0,//精确到哪位
    });
});